import 'package:flutter_bmflocation/src/models/flutter_baidu_location_base_option.dart';

/// 设置ohos端定位参数类
class BaiduLocationOhosOption extends BMFLocationBaseOption {
  /// 坐标系类型
  @Deprecated('已废弃since2.0.1，推荐使用 `coordType`')
  String? coorType;

  /// 是否需要返回地址信息
  bool? isNeedAddress;

  /// 是否需要返回周边poi信息
  bool? isNeedLocationPoiList;

  /// 是否需要返回位置描述信息
  bool? isNeedLocationDescribe;

  /// 设置定位模式，可选的模式有高精度、仅设备、仅网络。默认为高精度模式
  BMFOhosLocationMode? locationMode;


  /// 可选，设置返回经纬度坐标类型，默认GCJ02
  void setCoorType(String coorType) {
    this.coorType = coorType;
  }

  /// 可选，设置返回经纬度坐标类型，默认gcj02
  void setCoordType(BMFLocationCoordType coordType) {
    this.coordType = coordType;
  }

  /// 是否需要返回地址信息
  void setIsNeedAddress(bool isNeedAddress) {
    this.isNeedAddress = isNeedAddress;
  }

  /// 是否需要返回周边poi信息
  void setIsNeedLocationPoiList(bool isNeedLocationPoiList) {
    this.isNeedLocationPoiList = isNeedLocationPoiList;
  }

  /// 是否需要返回位置描述信息
  void setIsNeedLocationDescribe(bool isNeedLocationDescribe) {
    this.isNeedLocationDescribe = isNeedLocationDescribe;
  }


  /// 设置定位模式，可选的模式有高精度、仅设备、仅网络，默认为高精度模式
  void setLocationMode(BMFOhosLocationMode locationMode) {
    this.locationMode = locationMode;
  }


  /// 构造方法
  BaiduLocationOhosOption({
    this.coorType,
    required BMFLocationCoordType coordType,
    this.isNeedAddress,
    // this.isNeedAltitude,
    this.isNeedLocationPoiList,
    // this.isNeedNewVersionRgc,
    this.isNeedLocationDescribe,
    // this.openGps,
    // this.scanspan = 0,
    this.locationMode = BMFOhosLocationMode.hightAccuracy,
    // this.locationPurpose = BMFLocationPurpose.other,
  }) : super(coordType: coordType);

  /// 获取对本类所有变量赋值后的map键值对
  Map<String, Object?> getMap() {
    return {
      "coorType": coorType,
      "isNeedAddress": isNeedAddress,
      "isNeedLocationPoiList": isNeedLocationPoiList,
      "isNeedLocationDescribe": isNeedLocationDescribe,
      "locationMode": locationMode?.index,
    };
  }
}

/// 定位模式枚举类
enum BMFOhosLocationMode {
  /// 高精度模式
  hightAccuracy,

  /// 低功耗模式
  batterySaving,

  /// 仅设备(Gps)模式
  deviceSensors
}

